<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />  
        <title>Railway Official Website</title>
        <link rel="stylesheet" href="css/foundation.css"/>
        <link rel="stylesheet" href="css/normalize.css"/>
        <link rel="stylesheet" href="css/jquery-ui.css" />
        <link rel="stylesheet" href="css/footable/footable.core.css"/>
        <link rel="stylesheet" href="css/pagination.css"/>
        <script src="js/vendor/jquery.js"></script>
        <script src="js/ui/jquery-ui.js"></script>
        <script src="js/vendor/custom.modernizr.js"></script>
        <script src="js/footable/footable.js"></script>
        <script src="js/profile.js"></script>
        <?php
        session_start();
        ?>
        <script>
            $(document).ready(function() {
                $('.footable').footable();
            });
        </script>
    </head>
    <body>
        <div id="picture" class="reveal-modal small" style="height: 500px;">
            <div class="row" >
                <div id="itemqrcode" class="small-8 small-offset-2 columns">

                </div>
                <div class="small-2 columns"></div>
                <div id="description" class="small-8 small-offset-2 columns">

                </div>
                <div class="small-2 columns"></div>
            </div>
            <a class="close-reveal-modal">&#215;</a>
        </div>
        <div id='overlay' style="display:none; opacity: 0.4;position: fixed;top: 0;left: 0;background-color: black;width: 100%;z-index: 5000;">
            <img src="img/loader.gif" style="opacity:1; position: absolute; top: 50%;left: 50%;margin-left:-16px;
                 margin-top:-16px';"/>
        </div>
        <div>
            <nav class="top-bar">
                <ul class="title-area">
                    <li class="name" onClick="void(0);">
                        <h1><a href="#">Railway Official Website</a></h1>
                    </li>
                    <li class="divider"></li>
                    <li class="toggle-topbar menu-icon">
                        <a href="#"><span>menu</span></a>
                    </li>
                </ul>
                <section class="top-bar-section">
                    <ul class="right">
                        <li class="divider"></li>
                        <li><a href="index.php">Home</a></li>
                        <li class="divider"></li>
                        <li><a href="index.php">Forum</a></li>
                        <li class="divider"></li>
                        <?php
                        if (isset($_SESSION['username'])) {
                            echo '<li><a href="profile.php?mode=21">My profile</a></li>';
                            echo '<li class="divider"></li>';
                            echo '<li><a href="logout.php">Logout</a></li>';
                            echo '<li class="divider"></li>';
                        }
                        else
                            echo '<li><a href="loginPage.php">Login</a></li>';
                        echo '<li class="divider"></li>';
                        ?>
                    </ul>
                </section>
            </nav>
        </div>
        <div class="row">
            <?php
            if (isset($_SESSION['username'])) {
                ?>
                <div class="columns">
                    <div clas="row">
                        <div class="large-9 push-3 columns">
                            <div class="row">
                                <?php
                                if (isset($_GET['mode'])) {
                                    $mode = $_GET['mode'];
                                    switch ($mode) {
                                        case 21;
                                            require_once 'classes/Member.php';
                                            require_once 'classes/Ticket.php';
                                            $m = new Member();
                                            $t = new Ticket();
                                            $ic = $m->getMemberIC($_SESSION['uid']);
                                            $recent = $t->getRecentTicket($ic);
                                            ?>
                                            <div class="large-11 large-offset-1 columns">
                                                <div id="content">
                                                    <h3>Welcome, <?php echo $_SESSION['username']; ?>!</h3>
                                                    <hr/>
                                                    <div class="row">
                                                        <div class="columns">
                                                            <p>Account balance : RM<?php echo number_format($m->checkBalance($_SESSION['uid']), 2); ?></p>
                                                            <p>Point accumulated : <?php echo $m->checkPoint($_SESSION['uid']); ?></p>
                                                        </div>
                                                    </div>
                                                    <hr/>
                                                    <div class="row">
                                                        <div class="columns">
                                                            <h5 class="subheader">Recently purchased ticket :</h5>
                                                            <div class="row">
                                                                <div class="columns">
                                                                    <?php
                                                                    if ($recent) {
                                                                        ?>
                                                                        <table class='footable toggle-arrow-small'>
                                                                            <thead>
                                                                                <th style="width: 130px">Reference No</th>
                                                                                <th data-hide='phone'>Class</th>
                                                                                <th data-hide='phone'>Origin</th>
                                                                                <th data-hide='phone'>Destination</th>
                                                                                <th data-hide='phone'>Departure</th>
                                                                                <th>Date Purchased</th>
                                                                            </thead>
                                                                            <tbody>
                                                                                <?php
                                                                                for ($i = 0; $i < count($recent); $i++) {
                                                                                    echo '<tr>' .
                                                                                    '<td><a href="viewticket.php?mode=view&referenceno=' . $recent[$i]['referenceno'] . '">' . str_pad($recent[$i]['referenceno'], 10, '0', STR_PAD_LEFT) . '</a></td>' .
                                                                                    '<td>' . $recent[$i]['class'] . '</td>' .
                                                                                    '<td>' . $recent[$i]['origin'] . '</td>' .
                                                                                    '<td>' . $recent[$i]['destination'] . '</td>' .
                                                                                    '<td>' . $recent[$i]['departuredate'] . ' ' . $recent[$i]['departure'] . '</td>' .
                                                                                    '<td>' . $recent[$i]['datepurchased'] . '</td>' .
                                                                                    '</tr>';
                                                                                }
                                                                                ?>
                                                                            </tbody>
                                                                        </table>
                                                                        <hr/>
                                                                    </div>
                                                                    <div class="columns">
                                                                        <a href="viewticket.php?mode=viewall" class="small button right">View all</a>
                                                                    </div>
                                                                    <?php
                                                                } else {
                                                                    ?>
                                                                    <p>No ticket has been purchased recently.</p>
                                                                </div>
                                                                <?php
                                                            }
                                                            ?>
                                                        </div>
                                                        <hr/>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <?php
                                        break;
                                    case 22:
                                        ?>
                                        <script>
                            $(document).ready(function() {
                                $('li').removeClass('active');
                                $('#22').addClass('active');
                            });
                                        </script>
                                        <div id="info" class="large-11 large-offset-1 columns alert-box" data-alert style="display: none">

                                        </div>
                                        <div class="large-11 large-offset-1 columns">
                                            <h3>Change password</h3>
                                            <form class="custom" id="passwordform">
                                                <input type="hidden" name="action" value="changePassword"/>
                                                <input type="hidden" name="uid" value="<?php echo $_SESSION['uid']; ?>"/>
                                                <fieldset>
                                                    <div class="row">
                                                        <div class="large-4 columns"> 
                                                            <label for="current" class="inline">Current password</label> 
                                                        </div> 
                                                        <div class="large-7 columns"> 
                                                            <input id="current" name="current" type="password" placeholder="Enter your current password" onblur="validatePassword(this);"/> 
                                                            <small id="currentErr" class="error" style="display: none">Required field</small> 
                                                        </div> 
                                                    </div> 
                                                    <div class="row"> 
                                                        <div class="large-4 columns"> 
                                                            <label for="new" class="inline">Enter new password</label> 
                                                        </div> 
                                                        <div class="large-7 columns"> 
                                                            <input id="new" name="new" type="password" placeholder="New password" onblur="validatePassword(this);"/> 
                                                            <small id="newErr" class="error" style="display: none">Required field</small> 
                                                        </div> 
                                                    </div> 
                                                    <div class="row"> 
                                                        <div class="large-4 columns"> 
                                                            <label for="confirm" class="inline">Confirm new password</label> 
                                                        </div> 
                                                        <div class="large-7 columns"> 
                                                            <input id="confirm" name="confirm" type="password" placeholder="Confirm password" onblur="validatePassword(this);"/> 
                                                            <small id="confirmErr" class="error" style="display: none">Required field</small> 
                                                        </div> 
                                                    </div> 
                                                    <hr/> 
                                                    <div class="row"> 
                                                        <div class="large-12 columns"> 
                                                            <input type="button" id="submit" value="Submit" class="button right small" onclick="changePassword();"/>
                                                        </div> 
                                                    </div> 
                                                </fieldset> 
                                            </form>
                                        </div>
                                        <?php
                                        break;
                                    case 23:
                                        ?>
                                        <script>
                            $(document).ready(function() {
                                $('li').removeClass('active');
                                $('#23').addClass('active');
                            });
                                        </script>  
                                        <div id="info" class="large-11 large-offset-1 columns alert-box" data-alert style="display: none">

                                        </div>
                                        <div class="large-11 large-offset-1 columns" id="formsec">
                                            <h3>Edit profile</h3>
                                            <form class="custom" id="profileform">
                                                <input type="hidden" name="action" value="updateDetails"/>
                                                <input type="hidden" name="uid" value="<?php echo $_SESSION['uid']; ?>"/>
                                                <fieldset>
                                                    <?php
                                                    require_once 'classes/Member.php';
                                                    $member = new Member();
                                                    $result = $member->getDetails($_SESSION['uid']);
                                                    ?>
                                                    <legend>Personal Details</legend>
                                                    <div class="row">
                                                        <div class="large-4 columns">
                                                            <label for="firstname" class="inline">First name</label>
                                                        </div>
                                                        <div class="large-8 columns">
                                                            <input id="firstname" name="firstname" type="text" value="<?php echo $result['firstname']; ?>"/>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="large-4 columns">
                                                            <label for="lastname" class="inline">Last name</label>
                                                        </div>
                                                        <div class="large-8 columns">
                                                            <input id="lastname" name="lastname" type="text" value="<?php echo $result['lastname']; ?>"/>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="large-4 columns">
                                                            <label for="gender" class="inline">Gender</label>
                                                        </div>
                                                        <div class="large-8 columns">
                                                            <div class="row">
                                                                <?php
                                                                if ($result['gender'] == 'M') {
                                                                    ?>
                                                                    <div class="large-4 large-offset-1 columns">
                                                                        <label for="gender" class="inline">
                                                                            <input name="gender" id="gender" type="radio" style="display: none" value='M' <?php echo 'checked'; ?>/>
                                                                            <span class="custom radio"></span>     Male
                                                                        </label>
                                                                    </div>
                                                                    <div class="large-4 left columns">
                                                                        <label for="gender" class="inline">
                                                                            <input name="gender" id="gender" type="radio" style="display: none" value='F' />
                                                                            <span class="custom radio"></span>     Female
                                                                        </label>
                                                                    </div>
                                                                <?php } else {
                                                                    ?>
                                                                    <div class="large-4 large-offset-1 columns">
                                                                        <label for="gender" class="inline">
                                                                            <input name="gender" id="gender" type="radio" style="display: none" value='M' />
                                                                            <span class="custom radio"></span>     Male
                                                                        </label>
                                                                    </div>
                                                                    <div class="large-4 left columns">
                                                                        <label for="gender" class="inline">
                                                                            <input name="gender" id="gender" type="radio" style="display: none" value='F' <?php echo 'checked'; ?>/>
                                                                            <span class="custom radio"></span>     Female
                                                                        </label>
                                                                    </div>
                                                                <?php }
                                                                ?>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="large-4 columns">
                                                            <label for="address" class="inline">Address</label>
                                                        </div>
                                                        <div class="large-8 columns">
                                                            <input id="address" name="address" type="text" value="<?php echo $result['address']; ?>"/>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="large-4 columns">
                                                            <label for="city" class="inline">City</label>
                                                        </div>
                                                        <div class="large-8 columns">
                                                            <input id="city" name="city" type="text" value="<?php echo $result['city']; ?>"/>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="large-4 columns">
                                                            <label for="state" class="inline">State</label>
                                                        </div>
                                                        <div class="large-8 columns">
                                                            <input id="state" name="state" type="text" value="<?php echo $result['state']; ?>"/>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="large-4 columns">
                                                            <label for="" class="inline">Postal code</label>
                                                        </div>
                                                        <div class="large-8 columns">
                                                            <input id="postcode" name="postcode" type="text" value="<?php echo $result['postcode']; ?>"/>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="large-4 columns">
                                                            <label for="contactno" class="inline">Contact Number</label>
                                                        </div>
                                                        <div class="large-8 columns">
                                                            <input id="contactno" name="contactno" type="text" value="<?php echo $result['contactno']; ?>"/>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="large-4 columns">
                                                            <label for="dob" class="inline">Date of birth</label>
                                                        </div>
                                                        <div class="large-8 columns">
                                                            <input id="dob" name="dob" type="text" value="<?php echo $result['dob']; ?>"/>
                                                        </div>
                                                    </div>
                                                </fieldset>
                                                <br/>
                                                <div class="row">
                                                    <div id="promptpw" class="large-12 columns">
                                                        <input type="button" value="Submit" class="right button small" onclick="promptPassword();"/>
                                                    </div>
                                                    <div id="lblpass" class="large-4 columns hidden-field">
                                                        <label for="password" class="inline">Enter your password</label>
                                                    </div>
                                                    <div id="iptpass" class="large-6 columns hidden-field">
                                                        <input type="password" id="password"/>
                                                        <small id="passwordErr" class="error hidden-field">Enter your password</small>
                                                    </div>
                                                    <div id="realsubmit" class="large-2 columns hidden-field">
                                                        <input type="button" value="Submit" class="right button small" onclick="checkPassword(<?php echo $_SESSION['uid']; ?>);"/>
                                                    </div>
                                                </div>
                                            </form>
                                        </div>
                                        <?php
                                        break;
                                    case 24:
                                        require_once 'classes/Member.php';
                                        $m = new Member();
                                        $icno = $m->getMemberIC($_SESSION['uid']);
                                        $point = $m->checkPoint($_SESSION['uid']);
                                        ?>
                                        <script>
                            $(document).ready(function() {
                                $('li').removeClass('active');
                                $('#24').addClass('active');
                            });
                                        </script>   
                                        <div id="info" class="large-11 large-offset-1 columns alert-box" data-alert style="display: none">

                                        </div>
                                        <div class="large-11 large-offset-1 columns">
                                            <input type="hidden" id="icno" value="<?php echo $icno; ?>"/>
                                            <input type="hidden" id="point" value="<?php echo $point; ?>"/>
                                            <h4>Point Redemption</h4>
                                            <hr/>
                                            <div class="row">
                                                <div class="columns">
                                                    <p>Total accumulated points : <span id="cumulatedpoint"><?php echo $point; ?></span></p>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="section-container tabs" data-section="tabs">
                                                    <section class="section">
                                                        <p class="title" data-section-title><a>Redeem Items</a></p>
                                                        <div class="content" data-section-content>
                                                            <dl class="sub-nav">
                                                                <dt>Filter :</dt>
                                                                <dd id="all" onclick="filterItem(this);"><a>All</a></dd>
                                                                <dd id="cpn" onclick="filterItem(this);"><a>Coupon</a></dd>
                                                                <dd id="crd" onclick="filterItem(this);"><a>Credit</a></dd>
                                                                <dd id="svr" onclick="filterItem(this);"><a>Souvenir</a></dd>
                                                            </dl>
                                                            <div class="row panel" id="redeemitems">

                                                            </div>
                                                        </div>
                                                    </section>
                                                    <section class="section">
                                                        <p class="title" data-section-title><a onclick="getRedeemHistory();">Redemption History</a></p>
                                                        <div class="content" data-section-content>
                                                            <div id="history">

                                                            </div>
                                                        </div>
                                                    </section>
                                                </div>
                                            </div>

                                        </div>
                                        <?php
                                        break;
                                    case 25:
                                        ?>
                                        <?php
                                        if (isset($_GET['success'])) {
                                            ?>
                                            <form id="success" action="success.php" method="post">
                                                <input type="hidden" name="success" value="<?php echo $_GET['success']; ?>"/>
                                                <input type="hidden" name="amount" value="<?php echo $_GET['amount']; ?>"/>
                                            </form>
                                            <script>
                                $('#success').submit();
                                            </script>
                                            <?php
                                        } else {
                                            ?>
                                            <script>
                                                $(document).ready(function() {
                    //                                                    $.get('http://rate-exchange.appspot.com/currency', {
                    //                                                        from: 'MYR', to: 'USD'
                    //                                                    }, function(result) {
                    //                                                        if (!result.err) {
                                                    $('#50').val((50 * 0.31790).toFixed(2));
                                                    $('#100').val((100 * 0.31790).toFixed(2));
                                                    $('#200').val((200 * 0.31790).toFixed(2));
                                                    $('#buy50').prop('disabled', false);
                                                    $('#buy100').prop('disabled', false);
                                                    $('#buy200').prop('disabled', false);
                    //                                                        } else {
                    //                                                            $('#info').fadeIn('slow').addClass('alert').removeClass('success').html('There was some error occured, please try again later').delay(4000).fadeOut('slow');
                    //                                                            $('#buy50').prop('disabled', true);
                    //                                                            $('#buy100').prop('disabled', true);
                    //                                                            $('#buy200').prop('disabled', true);
                    //                                                        }
                    //                                                    }, 'jsonp');
                                                    $('li').removeClass('active');
                                                    $('#25').addClass('active');
                                                });
                                            </script>      
                                            <div id="info" class="large-11 large-offset-1 columns alert-box" data-alert style="display: none">

                                            </div>
                                            <div class="large-11 large-offset-1 columns">
                                                <div class="row">
                                                    <h3>Select reload option</h3>
                                                    <hr/>
                                                    <div class="large-12 columns">
                                                        <div id="purchase" class="row panel">
                                                            <div class="large-4 columns">
                                                                <ul class="pricing-table">
                                                                    <li class="title">Reload Option 1</li>
                                                                    <li class="price">RM 50</li>
                                                                    <li class="description">Reload RM 50 into your account</li>
                                                                    <li class="cta-button">
                                                                        <form action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post' name='frmPayPal1'>
                                                                            <input type='hidden' name='business' value='creditreload@railway.com '/>
                                                                            <input type='hidden' name='cmd' value='_xclick'/>
                                                                            <input type='hidden' name='item_name' value='Credit Reload RM50'/>
                                                                            <input type='hidden' id="50" name='amount' value='50'/>
                                                                            <input type='hidden' name='no_shipping' value='1'/>
                                                                            <input type='hidden' name='currency_code' value='USD'/>
                                                                            <input type='hidden' name='handling' value='0'/>
                                                                            <input type='hidden' name='cancel_return' value='http://localhost/RailwayWeb/profile.php?mode=25'/>
                                                                            <input type='hidden' name='return' value='http://localhost/RailwayWeb/profile.php?mode=25&amount=50&success=true'/>
                                                                            <input style="width: 100%" type="image" id="buy50" src="img/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"/>
                                                                        </form> 
                                                                    </li>
                                                                </ul>
                                                            </div>
                                                            <div class="large-4 columns">
                                                                <ul class="pricing-table">
                                                                    <li class="title">Reload Option 2</li>
                                                                    <li class="price">RM 100</li>
                                                                    <li class="description">Reload RM 100 into your account</li>
                                                                    <li class="cta-button">
                                                                        <form action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post' name='frmPayPal1'>
                                                                            <input type='hidden' name='business' value='creditreload@railway.com '/>
                                                                            <input type='hidden' name='cmd' value='_xclick'/>
                                                                            <input type='hidden' name='item_name' value='Credit Reload RM100'/>
                                                                            <input type='hidden' id="100" name='amount' value='100'/>
                                                                            <input type='hidden' name='no_shipping' value='1'/>
                                                                            <input type='hidden' name='currency_code' value='USD'/>
                                                                            <input type='hidden' name='handling' value='0'/>
                                                                            <input type='hidden' name='cancel_return' value='http://localhost/RailwayWeb/profile.php?mode=25'/>
                                                                            <input type='hidden' name='return' value='http://localhost/RailwayWeb/profile.php?mode=25&amount=100&success=true'/>
                                                                            <input style="width: 100%" type="image" id="buy100" src="img/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"/>
                                                                        </form>
                                                                    </li>
                                                            </div>
                                                            <div class="large-4 columns">
                                                                <ul class="pricing-table">
                                                                    <li class="title">Reload Option 3</li>
                                                                    <li class="price">RM 200</li>
                                                                    <li class="description">Reload RM 200 into your account</li>
                                                                    <li class="cta-button">
                                                                        <form action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post' name='frmPayPal1'>
                                                                            <input type='hidden' name='business' value='creditreload@railway.com '/>
                                                                            <input type='hidden' name='cmd' value='_xclick'/>
                                                                            <input type='hidden' name='item_name' value='Credit Reload RM200'/>
                                                                            <input type='hidden' id="200" name='amount' value='200'/>
                                                                            <input type='hidden' name='no_shipping' value='1'/>
                                                                            <input type='hidden' name='currency_code' value='USD'/>
                                                                            <input type='hidden' name='handling' value='0'/>
                                                                            <input type='hidden' name='cancel_return' value='http://localhost/RailwayWeb/profile.php?mode=25'/>
                                                                            <input type='hidden' name='return' value='http://localhost/RailwayWeb/profile.php?mode=25&amount=200&success=true'/>
                                                                            <input style="width: 100%" type="image" id="buy200" src="img/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"/>
                                                                        </form>
                                                                    </li>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <?php
                                                }
                                                ?>
                                            </div>
                                        </div>
                                        <?php
                                        break;
                                    case 26:
                                        ?>
                                        <script>
                                            $(document).ready(function() {
                                                $('li').removeClass('active');
                                                $('#26').addClass('active');
                                            });
                                        </script>   
                                        <div id="info" class="large-10 large-offset-1 columns alert-box" data-alert style="display: none">

                                        </div>
                                        <div class="large-10 large-offset-1 columns">
                                            <h3>Purchase ticket</h3>
                                            <form id="ticketform" class="custom">
                                                <input type="hidden" id="getroute" value="getRoute"/>
                                                <input type="hidden" id="getorigin" value="getOrigin"/>
                                                <input type="hidden" id="getdestin" value="getDestin"/>
                                                <input type="hidden" name="action" value="obtainSchedule"/>
                                                <script>
                                                    $(function() {
                                                        getRoute();
                                                    });
                                                </script>
                                                <div class="row">
                                                    <div class="large-4 columns">
                                                        <label for="route" class="inline">Route</label>
                                                    </div>
                                                    <div id="routediv" class="large-8 columns">
                                                        <select id="route" name="route" onchange="getOrigin();">
                                                            <option value="0">Select a route</option>
                                                        </select>
                                                    </div>
                                                </div>
                                                <div class="row">
                                                    <div class="large-4 columns">
                                                        <label for="origin" class="inline">Origin</label>
                                                    </div>
                                                    <div class="large-8 columns">
                                                        <select id="origin" name="origin" onchange="getDestination();">
                                                            <option value="0">Select Origin</option>
                                                        </select>
                                                    </div>
                                                </div>
                                                <div class="row">
                                                    <div class="large-4 columns">
                                                        <label for="destin" class="inline">Destination</label>
                                                    </div>
                                                    <div class="large-8 columns">
                                                        <select id="destin" name="destin" >
                                                            <option value="0">Select Destination</option>
                                                        </select>
                                                    </div>
                                                </div>
                                                <div class="row">
                                                    <div class="large-4 columns">
                                                        <label for="date" class="inline">Date of Journey</label>
                                                    </div>
                                                    <div class="large-8 columns">
                                                        <input type="text" id="date" name="date" readonly/>
                                                    </div>
                                                </div>
                                                <hr/>
                                                <div class="row">
                                                    <div class="large-12 columns">
                                                        <input type="button" value="Submit" class="button small right" onclick="obtainSchedule();"/>
                                                    </div>
                                                </div>
                                            </form>
                                        </div>
                                        <div class="large-12 columns">
                                            <form id="schedule" class="custom">

                                            </form>
                                        </div>
                                        <?php
                                        break;
                                }
                            } else {
                                ?>
                                <div id="info" class="large-11 large-offset-1 columns alert-box" data-alert style="display: none">

                                </div>
                                <div class="large-11 large-offset-1 columns">
                                    <div id="content">
                                        <h3>Welcome, <?php echo $_SESSION['username']; ?>!</h3>
                                        <hr/>
                                        <p>Please make selection from the side navigation</p>
                                    </div>
                                </div>
                                <?php
                            }
                            ?>
                        </div>
                    </div>
                    <div class="large-3 pull-9 columns panel">
                        <a href="profile.php?mode=21"><h5>User Profile</h5></a>
                        <ul class="side-nav">
                            <li id="22"><a href="profile.php?mode=22">Change password</a></li>
                            <li class="divider"></li>
                            <li id="23"><a href="profile.php?mode=23">Maintain profile</a></li>
                            <li class="divider"></li>
                            <li id="24"><a href="profile.php?mode=24">Point redemption</a></li>
                            <li class="divider"></li>
                            <li id="25"><a href="profile.php?mode=25" onclick="getCurrency();">Reload account</a></li>
                            <li class="divider"></li>
                            <li id="26"><a href="profile.php?mode=26">Purchase ticket</a></li>
                            <li class="divider"></li>
                            <li><a href="viewticket.php?mode=viewall">View ticket history</a></li>
                        </ul>
                    </div>
                </div>
            </div>
            <?php
        } else {
            ?>
            <div class="row">
                <div class="large-10 large-offset-1 columns panel">
                    You do not have the permission to access this page, please <a href="loginPage.php">login</a> first.
                    <?php
                    if (isset($_SERVER['HTTP_REFERER'])) {
                        echo '<br/>Click <a href="' . $_SERVER['HTTP_REFERER'] . '">here</a> to back to previous page.';
                    }
                    ?>
                </div>
            </div>
            <?php
        }
        ?>

        </div>
        <footer class="row">
            <div class="large-12 columns">
                <hr />
                <div class="row">
                    <div class="large-4 columns">
                        <p>&copy; Copyright 2013.</p>
                    </div>
                    <div class="large-6 columns">
                        <ul class="inline-list right">
                            <li><a href="aboutus.php">About Us</a></li>
                            <li><a href="contactus.php">Contact Us</a></li>
                            <li><a href="terms.php">Terms and Condition</a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </footer>
        <script src="js/foundation.min.js"></script>
        <script>
                                    $(document).foundation();
        </script>
    </body>
</html>